package model

import (
	"gorm.io/gorm"
	"time"
)

type Video struct {
	Id        uint32         `gorm:"column:id;type:int UNSIGNED;primaryKey;not null;" form:"id" json:"id"`
	UserId    int32          `gorm:"column:user_id;type:int;comment:发布人id;not null;" form:"user_id" json:"user_id"`                                       // 发布人id
	Author    string         `gorm:"column:author;type:varchar(30);comment:发布人;not null;" form:"author" json:"author"`                                    // 发布人
	Title     string         `gorm:"column:title;type:varchar(40);comment:标题;not null;" form:"title" json:"title"`                                        // 标题
	Image     string         `gorm:"column:image;type:varchar(500);comment:封面;not null;" form:"image" json:"image"`                                       // 封面
	Url       string         `gorm:"column:url;type:varchar(500);comment:视频地址;not null;" form:"url" json:"url"`                                           // 视频地址
	Plays     int32          `gorm:"column:plays;type:int;comment:播放量;not null;default:0;" form:"plays" json:"plays"`                                     // 播放量
	Status    int8           `gorm:"column:status;type:tinyint(1);comment:状态 0:审核中 1:审核通过 2:审核失败 3:视频下架;not null;default:0;" form:"status" json:"status"` // 状态 0:审核中 1:审核通过 2:审核失败 3:视频下架
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" form:"created_at" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" form:"updated_at" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" form:"deleted_at" json:"deleted_at"`
}

func (v Video) TableName() string {
	return "video"
}
